package com.qf.main.pharmacy.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.qf.common.db.utils.CommonBeanutils;
import com.qf.main.pharmacy.common.qo.OrderMallQo;
import com.qf.main.pharmacy.common.qo.OrderQo;
import com.qf.main.pharmacy.common.vo.OrderMallVo;
import com.qf.main.pharmacy.entity.OrderMall;
import com.qf.main.pharmacy.mapper.OrderMallMapper;
import com.qf.main.pharmacy.service.OrderMallService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author chengqiang
 * @Create 2024-02-23-14:02
 * @Description:
 */
@Service
public class OrderMallServiceImpl implements OrderMallService {
    @Resource
    private OrderMallMapper orderMallMapper;

    @Override
    public List<OrderMallVo> listOrderMall(Long shopNo) {
        QueryWrapper<OrderMall> qw =new QueryWrapper<>();
        qw.eq(OrderMall.COL_ORDER_NO,shopNo);
        List<OrderMall> orderMalls = orderMallMapper.selectList(qw);
        List<OrderMallVo> orderMallVos = CommonBeanutils.convertListTo(orderMalls, OrderMallVo::new);
        return orderMallVos;
    }

    @Override
    public Integer modifyOrderMall(OrderMallQo orderMallQo) {
        OrderMall orderMall = CommonBeanutils.convertTo(orderMallQo, OrderMall::new);
        return orderMallMapper.updateById(orderMall);
    }
}
